'use strict';
const db = uniCloud.database();
const ban = db.collection('student'); //集合名就是数据表的名称



async function testuser(event, context) {
	if (event.type == "add") {
		const res = ban.add(event.data)
		res.msg = "添加成功"
		return res
	}
	if (event.type == "find") {

		const res = await ban.orderBy("_id", "desc").get()
		res.msg = "查询成功"
		return res

	}
	if (event.type == "delete") {

		const res = await ban.where({
			_id: event.data._id
		}).remove()
		res.msg = "删除成功"
		return res

	}



}


exports.main = testuser
